﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.MultiEditingInPathEditor.SetLocationsProperties.CCUiSLPSetLocationsPropertiesPickObjectDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.MultiEditingInPathEditor.SetLocationsProperties;

public class CCUiSLPSetLocationsPropertiesPickObjectDlg : TxForm
{
  private ITxObject _pickedObject;
  private DialogResult _dlgResult;
  private string _propertyID;
  private IContainer components;
  private TxObjEditBoxCtrl txebObject;
  private Label lblObject;
  private Button btnOK;
  private Button btnCancel;

  public ITxObject PickedObject
  {
    get => this._pickedObject;
    private set => this._pickedObject = value;
  }

  public DialogResult DlgResult
  {
    get => this._dlgResult;
    private set => this._dlgResult = value;
  }

  public string PropertyID
  {
    get => this._propertyID;
    private set => this._propertyID = value;
  }

  public CCUiSLPSetLocationsPropertiesPickObjectDlg(
    TxTypeFilter typeFilter,
    string propertyID,
    ITxObject preSelectedObject)
  {
    // ISSUE: unable to decompile the method.
  }

  private void btnCancel_Click(object sender, EventArgs e)
  {
    this.PickedObject = (ITxObject) null;
    this.DlgResult = DialogResult.Cancel;
    ((Form) this).Close();
  }

  private void btnOK_Click(object sender, EventArgs e)
  {
    this.DlgResult = DialogResult.OK;
    ((Form) this).Close();
  }

  private void txebObject_Picked(object sender, TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.PickedObject = this.txebObject.Object;
    if (this.PickedObject == null)
      this.btnOK.Enabled = false;
    else
      this.btnOK.Enabled = true;
  }

  private void txebObject_TypeInvalid(object sender, EventArgs e)
  {
    this.PickedObject = (ITxObject) null;
    if (!string.IsNullOrEmpty(((Control) this.txebObject).Text))
      this.btnOK.Enabled = false;
    else
      this.btnOK.Enabled = true;
  }

  private void txebObject_TypeValid(object sender, EventArgs e)
  {
    this.PickedObject = this.txebObject.Object;
    this.btnOK.Enabled = true;
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    this.txebObject = new TxObjEditBoxCtrl();
    this.lblObject = new Label();
    this.btnOK = new Button();
    this.btnCancel = new Button();
    ((Control) this).SuspendLayout();
    this.txebObject.ListenToPick = false;
    ((Control) this.txebObject).Location = new Point(59, 12);
    ((Control) this.txebObject).Name = "txebObject";
    this.txebObject.Object = (ITxObject) null;
    this.txebObject.PickLevel = (TxPickLevel) 1;
    this.txebObject.ReadOnly = false;
    ((Control) this.txebObject).Size = new Size(188, 20);
    ((Control) this.txebObject).TabIndex = 0;
    this.txebObject.ValidatorType = (TxValidatorType) 1;
    this.txebObject.TypeInvalid += new EventHandler(this.txebObject_TypeInvalid);
    this.txebObject.TypeValid += new EventHandler(this.txebObject_TypeValid);
    this.txebObject.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.txebObject_Picked);
    this.lblObject.AutoSize = true;
    this.lblObject.Location = new Point(12, 15);
    this.lblObject.Name = "lblObject";
    this.lblObject.Size = new Size(41, 13);
    this.lblObject.TabIndex = 1;
    this.lblObject.Text = "Object:";
    this.btnOK.Location = new Point(91, 38);
    this.btnOK.Name = "btnOK";
    this.btnOK.Size = new Size(75, 23);
    this.btnOK.TabIndex = 3;
    this.btnOK.Text = "OK";
    this.btnOK.UseVisualStyleBackColor = true;
    this.btnOK.Click += new EventHandler(this.btnOK_Click);
    this.btnCancel.Location = new Point(172, 38);
    this.btnCancel.Name = "btnCancel";
    this.btnCancel.Size = new Size(75, 23);
    this.btnCancel.TabIndex = 4;
    this.btnCancel.Text = "Cancel";
    this.btnCancel.UseVisualStyleBackColor = true;
    this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
    ((Form) this).AcceptButton = (IButtonControl) this.btnOK;
    ((ContainerControl) this).AutoScaleDimensions = new SizeF(6f, 13f);
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Form) this).CancelButton = (IButtonControl) this.btnCancel;
    ((Form) this).ClientSize = new Size(259, 73);
    ((Control) this).Controls.Add((Control) this.btnCancel);
    ((Control) this).Controls.Add((Control) this.btnOK);
    ((Control) this).Controls.Add((Control) this.lblObject);
    ((Control) this).Controls.Add((Control) this.txebObject);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CCUiSLPSetLocationsPropertiesPickObjectDlg);
    ((Control) this).Text = "Pick an Object";
    ((Form) this).TopMost = true;
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }
}
